package controllers

import (
	"fmt"
	"io"
	"net/http"
	"os"
)

func RealTime(w http.ResponseWriter, _ *http.Request) {
	file, err := os.Open("controllers/realtime.html")
	if err != nil {
		fmt.Printf("open realtime.html error: %v\n", err)
		w.WriteHeader(502)
		_, _ = w.Write([]byte("realtime.html not found\n"))
		return
	}

	defer file.Close()

	_, _ = io.Copy(w, file)
}
